package dq.study.minimvc.reflect;

import java.lang.reflect.Method;
import java.lang.reflect.Parameter;

public class HandlerMethod {
    private final Object bean;

    private final Method method;

    private final Parameter[] parameters;

    public HandlerMethod(Object bean, Method method) {
        this.bean = bean;
        this.method = method;
        this.parameters = initMethodParameters();
    }


    protected HandlerMethod(HandlerMethod handlerMethod) {
        this.bean = handlerMethod.bean;
        this.method = handlerMethod.method;
        this.parameters = initMethodParameters();
    }

    private Parameter[] initMethodParameters() {
        return method.getParameters();
    }

    public Object getBean() {
        return this.bean;
    }

    public Method getMethod() {
        return this.method;
    }

    public Parameter[] getMethodParameters() {
        return this.parameters;
    }
}
